
import * as CONSTANT from '../constant';

//01 定义初始state
const defaultState = {count:0}  // js 任何有效值

//02 定义reducer : 根据action执行reducer 
const reducer  = (state=defaultState,action)=>{
    switch (action.type) {
        case CONSTANT.INCREMENT:
            return {count:state.count + 1} //返回新的对象
        case CONSTANT.DECREMENT:
            return {count:state.count - 1} 
        default:
           return state
    }
}

export default reducer